<template>
  <el-table :data="list" border stripe>
    <el-table-column label="内容">
      <template #default="scope">
        <span v-html="scope.row.content"></span>
      </template>
    </el-table-column>
    <el-table-column prop="createdName" label="创建人"></el-table-column>
    <el-table-column prop="createdTime" label="创建时间"></el-table-column>
  </el-table>
</template>

<script>
import { onBeforeMount, ref, toRefs, watch } from 'vue'
import { queryProjectHistoryListUrl } from '@/api/api'
import { post } from '@/utils/httpRequest'

export default {
  name: 'projectHistory',
  setup (props) {
    const { id } = toRefs(props)
    const list = ref([])
    const queryProjectHistoryListAsync = async () => {
      const result = await post(queryProjectHistoryListUrl, { id: id.value })
      if (result.code === 200) {
        list.value = result.data
      }
    }
    watch(() => id.value, () => {
      queryProjectHistoryListAsync()
    })
    onBeforeMount(() => {
      queryProjectHistoryListAsync()
    })
    return {
      list
    }
  },
  props: {
    // 项目id
    id: {
      type: Number,
      default: 0,
      required: true
    }
  }
}
</script>

<style scoped>

</style>
